function md5_sign(data)
{
  var md5 = require('md5.js');
  let str = '';
  data = ksort(data);
  for (let i in data) {
      if (i !== '')
      {
          str += i + data[i]
      }
  }
  data.req_time = Math.round(new Date()/1000);
  data.sign = md5.md5("heguanjia" + str + data.req_time);
  return data;
  function ksort(o) {
      let sorted = {},
      keys = Object.keys(o);
      keys.sort();
      keys.forEach((key)=>{
          sorted[key] = o[key];
      })
      return sorted;
  }
}

module.exports = {
  md5_sign: md5_sign
} 


